<template>
	<view class="appBox">
		<!-- 收益记录 -->
		<view class="syjl">
			<view class="syjl-item" v-for="(item,index) in accountMoneyList" :key="index">
				<view class="item-left">
					<text class="left-title">{{ item.title }}</text>
					<text class="left-date">{{ item.add_time }}</text>
				</view>
				<view class="item-right">
					<text v-if="item.pm == 0"> - {{ item.number }} </text>
					<text v-else-if="item.pm == 1"> + {{ item.number }} </text>
					<text v-else>{{ item.number }}</text>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	import store from "@/store/index.js"
	import {
		userBillRecord
	} from "@/api/user";
	import {
		mapGetters
	} from "vuex";
	export default {
		name: 'account_money',
		data() {
			return {
				category: "COMMISSION_TYPE",
				accountMoneyList: [],
				accountMoneyNavigator: '/pages/users/goldtrading/index',
				isLoad:true,
				page:1,
				limit:50
			}
		},
		computed: mapGetters(['isLogin', 'chatUrl', 'userInfo', 'uid']),
		mounted() {
			//this.getCode();
		},
		onLoad: function(options) {

		},
		onShow() {
			this.accountM()
			store.dispatch("USERINFO")
		},
		onReachBottom() {
			console.log("BBBBBBBBBB"+this.isLoad)
			if(this.isLoad){
				this.accountM();
			}
			
		},
		methods: {
			async accountM() {
				let that = this
				uni.showLoading({
					title: '正在加载'
				})
				userBillRecord(this.category,that.page,that.limit).then((res) => {
					this.accountMoneyList = this.accountMoneyList.concat(res.data) 
					if(res.data.length < that.limit){
						that.isLoad = false
					}else{
						 that.page++;
					}
					// console.log("AAAAAAAAA"+that.isLoad)
					console.log("res1111", res)
					uni.hideLoading()
				}).catch((res) => {
					this.$util.Tips({
						title: res
					});
					uni.hideLoading()
				})
			},
		}

	}
</script>

<style>
	page {
		height: 100%;
	}
</style>
<style lang="scss" scoped>
	.appBox {
		background-color: #F2F6FD;
		padding: 20rpx;

		.syjl {
			.syjl-item {
				display: flex;
				justify-content: space-between;
				height: 114rpx;
				padding: 18rpx 22rpx 15rpx 21rpx;
				background: #fff;
				margin-top: 18rpx;

				.item-left {
					display: flex;
					flex-direction: column;
					justify-content: space-between;

					.left-title {
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 26rpx;
						color: #333333;
					}

					.left-date {
						font-family: PingFang SC;
						font-weight: 400;
						font-size: 22rpx;
						color: #999999;
						line-height: 30rpx;
					}
				}

				.item-right {
					color: #EA6D07;
					font-size: 26rpx;
				}
			}
		}
	}


	page {
		background-color: #fff !important;
	}
</style>